package com.sise.wangzhan.controller;

import com.sise.wangzhan.client.BookService;
import com.sise.wangzhan.entity.Book;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;



/**
 * @Classname BookInvokerController
 * @Description TODO
 * @Date 2020/5/14 11:28
 * @Created by wangzhan
 */
@RestController
public class BookInvokerController {
    @Autowired
    private BookService bookService;

    @RequestMapping(value = "/book-invoker/{bookId}", method = RequestMethod.GET)
    public String bookInvoker(@PathVariable Integer bookId){
        // 调用book服务查找
        Book book = bookService.getBook(bookId);
        // 控制台输出
        System.out.println("书id："+book.getId()+",名字:"+book.getName()+",作者："+book.getAuthor());
        return "SUCCESS";
    }

}
